package com.yellow.cloud.security.autoconfigure;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 外部配置属性
 * @author zhou
 * @since  2021/6/16 11:14
 */
@Component
public class SecurityProperties {

    public static Auth auth;

    public SecurityProperties(Auth auth){
        SecurityProperties.auth = auth;
    }

    @Data
    @Component
    @ConfigurationProperties("yellow.cloud.security.auth")
    public static class Auth {

        /** 用户信息存储到redis的过期时间(秒) */
        private long userValiditySeconds = 3600L;

        /** cookie信息存活时间(秒) */
        private int cookieMaxAge = -1;

        /** 客户端id */
        private String clientId;

        /** 客户端秘钥 */
        private String clientSecret;

        /** 签发cookie的服务器ip/域名。本地的话，用localhost */
        private String cookieDomain = "zhou.com";
    }
}
